<?php
require_once("./classes/class.tqq.php");
require_once("./classes/class.twitter.php");
$title = '微博';
$info = array('title'=>$title,'description'=>$this->setting->blogname);
$posts = array();
$p = $this->get_page_params(array());
$p['_home'] = $this->url('home');
$p['_request'] = $this->request;
$p['_posts'] = null;
$p['_pager'] = array(
	'f'=>intval($this->get('f')),
	't'=>intval($this->get('t')),
	'l'=>intval($this->get('l')),
	'i'=>$this->get('i')
);
$uid = 'ghostwei';

if(isset($p['k'])) {
	//keywords
	header('Location:http://www.haotu.la/t/' . $p['k']);
	exit;
	$info['title'] = $p['k'];
	$info['description'] = " $title | " . $this->setting->blogname;
	$posts = cmsdream_tqq::api()->getTopic(array('t'=>$p['k'],'f'=>$p['_pager']['f'],'n'=>30,'p'=>$p['_pager']['i']));
	$posts = $posts['data'];
} else if(isset($p['param']) && $p['param'] != '') {
	header('Location:http://www.haotu.la/@/' . $p['param']);
	exit;
	$info['title'] = $p['param'];
	$info['description'] = " $title | " . $this->setting->blogname;
	$uid = $p['param'];
	$posts = cmsdream_tqq::api()->getTimeline(array('name'=>$uid,'f'=>$p['_pager']['f'],'n'=>30,'t'=>$p['_pager']['t'],'l'=>$p['_pager']['l'],'utype'=>0,'ctype'=>0));
	$posts = $posts['data'];
} else {
	header('Location:http://www.haotu.la/sns/index');
	exit;
	$posts = cmsdream_tqq::api()->getTimeline(array('name'=>$uid,'f'=>$p['_pager']['f'],'n'=>30,'t'=>$p['_pager']['t'],'l'=>$p['_pager']['l'],'utype'=>0,'ctype'=>0));
	$posts = $posts['data'];
}
if(empty($posts)) $this->template = '404';

$p['_posts'] = $posts;
$twitter = new cmsdream_twitter($p);

$user	= $twitter->get_twitter_user($uid);
$famous	= $twitter->get_twitter_famous();
$topics	= $twitter->get_twitter_hot_topics();




